<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    
<%@page import="java.util.*, java.sql.*, data.*" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Where Do You Live?</title>
</head>
<body>

<% 
		
	ResultSet rset = (ResultSet) request.getAttribute("crsCountries");;
	Vector<String> countries = new Vector<String>();
	Vector<String> countryID = new Vector<String>();
	while(rset.next())
	{
		countryID.add(rset.getString("id"));
		countries.add(rset.getString("country"));
	}
%>

	<c:set var="studentData" scope="page" value="${sessionScope.StudentData}" />
	
	<c:forEach items="${formData}" var="line">
		<c:out value="${line}" /><br>
	</c:forEach>
	<br>
	<br>

		
	<br>Now, please tell me in which country you reside.<br><br>
	
	<html:link action="/pages/students/Address">
			<html:param name="residentID" value="${studentData.citizenID}" />
			<html:param name="resident" value="${studentData.citizen}" />
			Same as country of citizenship
		</html:link>	
	<br>
  	

	


	<div id="left_wrapper"> 
	<div id="left">
	<p>
	<%
	for(int i=0; i<countries.size()/3; i++)
	{%>

		<html:link action="/pages/students/Address">
			<html:param name="residentID" value="<%= countryID.get(i) %>" />
			<html:param name="resident" value="<%= countries.get(i) %>" />
			<%= countries.get(i) %>
		</html:link>
		<br>

	<%} %>
	
	</p>
	</div>
	</div>
	
	
	<div id="middle_wrapper"> 
	<div id="left">
	<p>
	
	<%
	for(int i=countries.size()/3; i< 2 * (countries.size()/3); i++)
	{ %>
		<html:link action="/pages/students/Address">
			<html:param name="residentID" value="<%= countryID.get(i) %>" />
			<html:param name="resident" value="<%= countries.get(i) %>" />
			<%= countries.get(i) %>
		</html:link>
		<br>
		
	<%} %>
	
	</p>
	</div>
	</div>
	
	<div id="right_wrapper">
	<div id="right">
	<p>
	
	<%
	for(int i= 2 * (countries.size()/3); i< countries.size(); i++)
	{%>
		<html:link action="/pages/students/Address">
			<html:param name="residentID" value="<%= countryID.get(i) %>" />
			<html:param name="resident" value="<%= countries.get(i) %>" />
			<%= countries.get(i) %>
		</html:link>
		<br>

	<%} %>
	
	</p>
	</div>
	</div>
	


<br><br>

</body>
</html>